<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>签约网</title>
    <link rel="stylesheet" type="text/css" href="../css/api.css" />
    <link rel="stylesheet" type="text/css" href="../css/style.css" />
    <link rel="stylesheet" type="text/css" href="../css/lawyer.css" />
    <script type="text/javascript" src="../script/api.js"></script>
    <script type="text/javascript" src="../script/jquery-1.9.1.min.js"></script>
    <script type="text/javascript" src="../script/mobile.js"></script>
    <script type="text/javascript" src="../script/lawyer.js"></script>
</head>
<body>
<div id="secHeader">
  <header class="header">
      <a href="javascript:void(0);" onclick="api.closeWin()" class="back_btn"><img src="../image/head-fanhui.png" alt=""></a>
      <h2>咨询回答</h2>
      <!--<a href="javascript:void (0);" class="share_btn"><img src="../image/share_icon.png" alt=""></a>-->
  </header>
</div>
<section class="ask_article">
    <div class="userInfo">
        <img src="" alt="" id='icon'>
        <div class="userName">
            <h6 id='phone'></h6>
            <span  id='time'></span>
        </div>
    </div>
    <div class="comment_info">
        <p id='content'></p>
    </div>
</section>
<section class="release_dynamic">
    <div class="release_list">
        <ul>
            <li>
                <textarea name="" id="answer" cols="30" rows="10" placeholder="请输入答案内容"></textarea>

            </li>
        </ul>
    </div>
</section>


<section class="fixed_ask">
    <a href="javascript:;"  class="ask_btn"  onclick="tijiao()">提交答案</a>
</section>

</body>

<script>
    var para
    apiready = function () {
      $api.fixStatusBar( $api.dom('#secHeader') );
      api.setStatusBarStyle({
          style: 'light'
      });


        para=api.pageParam

        var p={id:para.id}
        api.ajax({
                url: webSiteUrl+'/app/public/faskdetail',
                method: 'post',
                data: {
                    values: p
                }
            }, function(ret, err) {
                api.hideProgress();

                if(ret.code==200){


                    var tj=ret.data.uinfo;
                    $('#icon').attr('src',webSiteUrl+tj.icon);
                    $('#phone').html(tj.phone);


                    var info=ret.data.info;
                    $('#time').html(info.time);
                    $('#content').html(info.content);

                }
            });


    };
    var can=true;

    function tijiao(){
        if(!can){
            return;
        }
        can=false;

        var content=$('#answer').val();

        if(content==''){
            api.alert({msg:"请输入答案内容！"});return;
        }


        var  p={token:token,content:content,id:para.id,};

        api.ajax({
            url: webSiteUrl+'/app/user/answer',
            method: 'post',
            data: {
                values:p,
            }
        }, function(ret, err) {
            api.hideProgress();

            if(ret.code==200){

                alert(ret.msg);
                api.openWin({
                    name: 'workbench',
                    url: './workbench.html',
                    reload:true,
                    pageParam: {
                        id:para.id
                    }
                });
            }else{
                alert(ret.msg)
            }

        });
    }







</script>
</html>
